<?php
/**
 * MatchDart! is a darts event ranking table component for joomla
 * 
 * @version		2.0.1 | $Id: view.html.php 210 2010-06-14 21:07:35Z mwi.nor $
 * @package		MatchDart!
 * @subpackage	Site
 * @copyright	Copyright (C) 2005 - 2009 Marco Wilde. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 * @author		Marco Wilde, <mailto://info@matchdart.de>
 * @link		http://www.matchdart.de
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view' );

class MatchdartViewEvent extends JView
{
    public function display($tpl = null)
    {
        //JToolBarHelper::title( JText::_( 'MatchDart!') ." - ". JText::_( 'MD_MATCHES' ), 'matchdart' );
        JHTML::_('stylesheet', 'matchdart.css', 'administrator/components/com_matchdart/css/');
        $layout = JRequest::getVar('layout', null, 'get', 'STRING');

        $user =& JFactory::getUser();
        $userid = $user->id;
                
        // Get data from the model
        $event = $this->get('Event');
        $season = $this->get('Season');

        switch ( $layout )
		{
			case 'player'  :
		        $items =& $this->get('TablePlayerData');
		        $s_items =& $this->get('SchedulePlayer');
		        $pm_items =& $this->get('PlayoffMatches');
		        $lastupdate = $this->get('Lastupdate');
			break;
		
			case 'team':
		        $items =& $this->get('tableTeamData');
		        $lastupdate = $this->get('Lastupdate');
			break;

		}
        
        
		
        // Assign data to template
        $this->assignRef('userid', $userid);
		$this->assignRef('event', $event);
        $this->assignRef('season', $season);
		$this->assignRef('items', $items);
		$this->assignRef('s_items', $s_items);
		$this->assignRef('pm_items', $pm_items);
        $this->assignRef('lastupdate', $lastupdate);
        
        parent::display($tpl);
    }
}
?>